package com.java.mywxmp.controller;

import java.util.Arrays;
import java.util.Map;

import com.java.mywxmp.utils.PageUtils;
import com.java.mywxmp.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.java.mywxmp.entity.Reply;
import com.java.mywxmp.service.ReplyService;


/**
 * 回复表
 *
 * @author jl
 * @since 2020-08-25 14:53:40
 */
@RestController
@RequestMapping("/wx/reply")
public class ReplyController {
    @Autowired
    private ReplyService replyService;

    /**
     * 带条件分页查询reply
     */
    @GetMapping("/list")
    public R list(@RequestParam Map<String, Object> params) {
        PageUtils page = replyService.queryPage(params);

        return R.ok(page);
    }


    /**
     * 根据主键查询reply
     */
    @GetMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id) {
        Reply reply = replyService.getById(id);

        return R.ok(reply);
    }

    /**
     * 新增reply
     */
    @PostMapping("/save")
    public R save(@RequestBody Reply reply) {
        replyService.save(reply);

        return R.ok();
    }

    /**
     * 修改reply
     */
    @PutMapping("/update")
    public R update(@RequestBody Reply reply) {
        replyService.updateById(reply);

        return R.ok();
    }

    /**
     * 删除reply
     */
    @DeleteMapping("/delete")
    public R delete(@RequestBody Integer[] ids) {
        replyService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
